﻿<UserControl x:Class="MaxStoreShop.WarehouseModule.MeasureTypes.MeasureTypesView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:directories="clr-namespace:MaxStoreShop.Domain.Directories;assembly=MaxStoreShop.Domain"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:measureTypes="clr-namespace:MaxStoreShop.WarehouseModule.MeasureTypes"
             d:DataContext="{d:DesignInstance measureTypes:MeasureTypesViewModel}"
             d:DesignHeight="300"
             d:DesignWidth="300"
             mc:Ignorable="d">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Resources/Shared.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <DataTemplate x:Key="NameItemTemplate">
                <Border BorderBrush="#6FBDE8" BorderThickness="0,0,0,0">
                    <TextBox Margin="0"
                             HorizontalAlignment="Stretch"
                             VerticalAlignment="Center"
                             Background="Transparent"
                             BorderThickness="0"
                             IsReadOnly="True"
                             Text="{Binding Name}"
                             d:DataContext="{d:DesignInstance directories:MeasureType}" />
                </Border>
            </DataTemplate>
            <DataTemplate x:Key="ShortNameItemTemplate">
                <Border BorderBrush="#6FBDE8" BorderThickness="0,0,0,0">
                    <TextBox Margin="0"
                             HorizontalAlignment="Stretch"
                             VerticalAlignment="Center"
                             Background="Transparent"
                             BorderThickness="0"
                             IsReadOnly="True"
                             Text="{Binding ShortName}"
                             d:DataContext="{d:DesignInstance directories:MeasureType}" />
                </Border>
            </DataTemplate>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <ListView Name="MainListView"
                  ItemsSource="{Binding ViewerData}"
                  SelectedItem="{Binding SelectedItem,
                                         Mode=TwoWay}"
                  SelectionMode="Single">
            <ListView.View>
                <GridView d:DataContext="{d:DesignInstance directories:MeasureType}">
                    <GridView.Columns>
                        <GridViewColumn Width="200"
                                        CellTemplate="{StaticResource NameItemTemplate}"
                                        Header="Наименование" />
                        <GridViewColumn CellTemplate="{StaticResource ShortNameItemTemplate}" Header="Короткое наименование" />
                        <GridViewColumn CellTemplate="{StaticResource EditColumnItemTemplate}" />
                    </GridView.Columns>
                </GridView>
            </ListView.View>
        </ListView>
        <ToolBar Name="MainToolBar"
                 Grid.Row="1"
                 Visibility="Collapsed">
            <Button Width="44"
                    Height="44"
                    BorderThickness="0"
                    Command="{Binding AddNewItemCommand}"
                    Style="{DynamicResource MetroCircleButtonStyle}">
                <Path Width="32"
                      Height="32"
                      Data="{StaticResource AddIcon}"
                      Fill="{DynamicResource BlackBrush}"
                      Stretch="Uniform" />
            </Button>
        </ToolBar>
    </Grid>
</UserControl>
